package main

import (
	"os"
	"text/template"
)

type Person struct {
	Name string
	Age  int
}

func main() {
	//t := template.Must(
	//template.New("test").Funcs(
	//template.FuncMap{
	//"lt": func(a, b int) bool { return a < b },
	//"eq": func(a, b int) bool { return a == b },
	//},
	//).Parse(
	//"{{.Name}}:{{if .Age | lt 5}} 5 < age.{{else}} 5 > age.{{end}}\n",
	//),
	//)
	//t.Execute(os.Stdout, &Person{
	//Name: "lulu",
	//Age:  4,
	//})
	lili := Person{"lili", 12}
	tmpl, err := template.New("test").Parse("{{.Name}} has {{.Age}} old")
	if err != nil {
		panic(err)
	}
	err = tmpl.Execute(os.Stdout, lili)
	if err != nil {
		panic(err)
	}
}
